package com.sgb.member.ui.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.sgb.member.BR;
import com.sgb.member.R;
import com.sgb.member.entity.MemberLevelApproveBean;

import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class RatingBusinessAdapter extends BaseRecycleAdapter<MemberLevelApproveBean> {

    public RatingBusinessAdapter(Context context, List<MemberLevelApproveBean> datas) {
        super(context, R.layout.item_rating_business, datas);

    }

    @Override
    public void convert(ItemViewHolder holder, MemberLevelApproveBean bean) {
        holder.setBinding(BR.model, bean);

        ImageView ivStatus = holder.itemView.findViewById(R.id.img_status);
        if (!TextUtils.isEmpty(bean.getStatusName())) {
            ivStatus.setVisibility(View.VISIBLE);
            switch (bean.getStatusName()) {
                case "待调级":
                    ivStatus.setImageResource(R.mipmap.member_icon_lever_wait);
                    break;
                case "调级失败":
                    ivStatus.setImageResource(R.mipmap.member_icon_lever_failure);
                    break;
                case "调级成功":
                    ivStatus.setImageResource(R.mipmap.member_icon_lever_success);
                    break;
            }
        } else {
            ivStatus.setVisibility(View.GONE);

        }
    }

}
